package net.xo68.destiny.manager.service;

import lombok.extern.slf4j.Slf4j;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import net.xo68.destiny.manager.entity.SimpleTrigger;
import net.xo68.destiny.manager.mapper.SimpleTriggerMapper;



/** 
 * SimpleTrigger Service
 * @author wuxie(16349023@qq.com)
 * @date 2020年12月21日 21:43:52
 *
 */
@Slf4j
@Service
public class SimpleTriggerService{
    
    @Autowired
    private SimpleTriggerMapper simpleTriggerMapper;

    public SimpleTrigger find(Long jobId) {
        return  simpleTriggerMapper.find(jobId);
    }

    public SimpleTrigger insert(SimpleTrigger simpleTrigger) {
        simpleTriggerMapper.insert(simpleTrigger);
        return simpleTrigger;
    }

    public SimpleTrigger update(SimpleTrigger simpleTrigger) {
        simpleTriggerMapper.update(simpleTrigger);
        return simpleTrigger;
    }
    
    public int delete(Long jobId) {
        return simpleTriggerMapper.delete(jobId);
    }
    
    public List<SimpleTrigger> list() {
        return simpleTriggerMapper.list();
    }
	
	public PageInfo<SimpleTrigger> list(int pageNumber,int pageSize) {
        PageHelper.startPage(pageNumber, pageSize,true);
        List<SimpleTrigger> docs = simpleTriggerMapper.list();
        PageInfo<SimpleTrigger> pageInfo = new PageInfo<SimpleTrigger>(docs);
        return pageInfo;
    }
}